const model = require('../model/actiondb/userModel')

class LoginService {

  async login(req) {
    let { username, password } = req.body
    let data = await model.one({ username, password })
    if (data) {
      // 登录成功 使用session保持用户登录状态
      req.session.username = data.username
      
      return true
    }
    return false
  }


}

module.exports = new LoginService()